package gold.digger;

import gold.utils.InputUtil;

/**
 * Created by fanzhenyu02 on 2021/12/10.
 * common problem solver template.
 */
public class LC747 {
    public long startExecuteTime = System.currentTimeMillis();


    class Solution {
        public int dominantIndex(int[] nums) {
            int n = nums.length;
            if (n == 1) return 0;
            int a = -1, b = 0;
            for (int i = 1; i < n; i++) {
                if (nums[i] > nums[b]) {
                    a = b;
                    b = i;
                } else if (a == -1 || nums[i] > nums[a]) {
                    a = i;
                }
            }
            return nums[b] >= nums[a] * 2 ? b : -1;
        }
    }


    public void run() {
        Solution solution = new Solution();
        int[] arr = InputUtil.toIntegerArray("[1,2,3]");
        System.out.println(solution.toString());
    }

    public static void main(String[] args) throws Exception {
        LC747 an = new LC747();
        an.run();

        System.out.println("\ncurrent solution total execute time: " + (System.currentTimeMillis() - an.startExecuteTime) + " ms.");
    }
}
